package com.ywu.gateway.spi.spi;

import com.ywu.api.spi.dto.ApiRouterDto;
import com.ywu.common.result.CommonResult;
import com.ywu.gateway.spi.dto.GatewayRouteRedisDto;
import com.ywu.gateway.spi.dto.GatewayRouterDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = "YWU-GATEWAY")
public interface GatewaySpi {
    @GetMapping("/ywu/gateway/router.refresh.info")
    CommonResult<Object> refresh();

    @GetMapping("/ywu/gateway/router.reload.info")
    CommonResult<Object> reloadRoute();

    @PostMapping("/ywu/gateway/router.delete.info")
    CommonResult<Object> delete(@RequestBody GatewayRouterDto gatewayRouterDto);

    @PostMapping("/ywu/gateway/api.route.redis.cache.info")
    CommonResult<List<GatewayRouteRedisDto>> apiRouteRedisCacheInfo(@RequestBody GatewayRouterDto gatewayRouterDto);

    @PostMapping("/ywu/gateway/add.api.route.for.spi")
    CommonResult<Object> addApiRouteCacheInfo(@RequestBody ApiRouterDto gatewayRouterDto);
}
